package com.itheima.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.itheima.domain.Book;
import com.itheima.domain.End;
import com.itheima.domain.Statistics;
import com.itheima.mapper.ListRankingMapper;
import com.itheima.mapper.UserMapper;
import com.itheima.service.ListRankingService;
import entity.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class ListRankingServiceImpI implements ListRankingService {

    @Autowired
    private ListRankingMapper listRankingMapper;
    @Override
    public PageResult showall(Object obj, Integer pageNum, Integer pageSize, String listname) {
        PageHelper.startPage(pageNum, pageSize);
        Page<End> page= listRankingMapper.showall(obj,pageNum,pageSize,listname);
        return new PageResult(page.getTotal(),page.getResult());


    }
    public PageResult     showstatistics(Object obj, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        Page<Statistics> page= listRankingMapper.showstatistics(obj,pageNum,pageSize);
        return new PageResult(page.getTotal(),page.getResult());

    }
}
